﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iHouse.Common.Helper
{
    public static class EnumHelper
    {
        public static IEnumerable<EnumData> ConvertEnumToList(Type enumObject)
        {
            List<EnumData> list = new List<EnumData>();

            foreach (int value in Enum.GetValues(enumObject))
            {
                EnumData item = new EnumData();
                item.Key = value;
                item.Value = Enum.GetName(enumObject, value);

                list.Add(item);
            }

            return list;
        }
    }
}
